package 新特征锁_取钱;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class test {
        public static void main(String[] args){
            Mycount mycount = new Mycount(10001010,10000);
            Lock lock = new ReentrantLock();//一个可重入的互斥锁
            ExecutorService pool = Executors.newCachedThreadPool();
            User u1 = new User("xiaowang",mycount,-4000,lock);
            User u2 = new User("小he",mycount,6000,lock);
            User u3 = new User("小谷",mycount,-8000,lock);
            User u4 = new User("小蔺",mycount,-9000,lock);
            pool.execute(u1);
            pool.execute(u2);
            pool.execute(u3);
            pool.execute(u4);
            pool.shutdown();

        }
    }


